Skip to content

Conversation

compiler-errors
Copy link
Member

This PR attempts to rework how we enforce const stability for const traits. Specifically, all const trait calls are treated as const-unstable, so we don't accidentally begin depending on const traits in the standard library in ways that are difficult to remove in the future (see #126552 for an example of the kind of changes that removing const traits required last time).

I didn't get all the way through it, though, and I kinda don't want to continue.

r? @ghost

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 28, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
------
 > importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:c32c805632780b5c1de330e3f44561b336c2efe163bc0990acb392390157a8e1d9f855d75914a239aa40c49d77f4a837247d05d2f8d46f554b98e1f46712a3e3:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
---- [ui] tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/specialization/const-default-const-specialized.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/specialization/const-default-const-specialized" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stderr: none


---- [ui] tests/ui/traits/const-traits/specializing-constness-2.rs stdout ----
---- [ui] tests/ui/traits/const-traits/specializing-constness-2.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/specializing-constness-2.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/specializing-constness-2" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stderr: none


---- [ui] tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs stdout ----
---- [ui] tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs stdout ----

error: ui test compiled successfully!
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/specialization/non-const-default-const-specialized.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/specialization/non-const-default-const-specialized" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
stderr: none


---- [ui] tests/ui/traits/const-traits/staged-api-user-crate.rs stdout ----
---- [ui] tests/ui/traits/const-traits/staged-api-user-crate.rs stdout ----

error: /checkout/tests/ui/traits/const-traits/staged-api-user-crate.rs:12: unexpected error: '12:5: 12:21: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn'
error: 1 unexpected errors found, 0 expected errors not found
status: exit status: 1
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/staged-api-user-crate.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api-user-crate" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api-user-crate/auxiliary"
--- unexpected errors (from JSON output) ---
--- unexpected errors (from JSON output) ---
ERROR     line  12: 12:5: 12:21: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn
thread '[ui] tests/ui/traits/const-traits/staged-api-user-crate.rs' panicked at src/tools/compiletest/src/runtest.rs:789:13:
errors differ from expected

---- [ui] tests/ui/traits/const-traits/staged-api.rs#unstable stdout ----
---- [ui] tests/ui/traits/const-traits/staged-api.rs#unstable stdout ----

error in revision `unstable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:35: unexpected error: '35:5: 35:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `unstable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:38: unexpected error: '38:5: 38:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `unstable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:42: unexpected error: '42:5: 42:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `unstable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:64: unexpected error: '64:5: 64:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `unstable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:67: unexpected error: '67:5: 67:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'
error in revision `unstable`: 5 unexpected errors found, 0 expected errors not found
status: exit status: 1
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/staged-api.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "unstable" "--check-cfg" "cfg(FALSE,stable,unstable)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api.unstable" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api.unstable/auxiliary" "-Znext-solver"
--- unexpected errors (from JSON output) ---
--- unexpected errors (from JSON output) ---
ERROR     line  35: 35:5: 35:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  38: 38:5: 38:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  42: 42:5: 42:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  64: 64:5: 64:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  67: 67:5: 67:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
thread '[ui] tests/ui/traits/const-traits/staged-api.rs#unstable' panicked at src/tools/compiletest/src/runtest.rs:789:13:
errors differ from expected

---- [ui] tests/ui/traits/const-traits/staged-api.rs#stable stdout ----
---- [ui] tests/ui/traits/const-traits/staged-api.rs#stable stdout ----

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:35: unexpected error: '35:5: 35:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:38: unexpected error: '38:5: 38:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:42: unexpected error: '42:5: 42:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:51: unexpected error: '51:5: 51:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:53: unexpected error: '53:5: 53:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:56: unexpected error: '56:5: 56:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:64: unexpected error: '64:5: 64:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'

error in revision `stable`: /checkout/tests/ui/traits/const-traits/staged-api.rs:67: unexpected error: '67:5: 67:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`'
error in revision `stable`: 8 unexpected errors found, 0 expected errors not found
status: exit status: 1
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/const-traits/staged-api.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "stable" "--check-cfg" "cfg(FALSE,stable,unstable)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api.stable" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/traits/const-traits/staged-api.stable/auxiliary" "-Znext-solver"
--- unexpected errors (from JSON output) ---
--- unexpected errors (from JSON output) ---
ERROR     line  35: 35:5: 35:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  38: 38:5: 38:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  42: 42:5: 42:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  51: 51:5: 51:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  53: 53:5: 53:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  56: 56:5: 56:22: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  64: 64:5: 64:21: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
ERROR     line  67: 67:5: 67:16: const function that might be (indirectly) exposed to stable cannot use `#[feature(const_trait_impl)]`
thread '[ui] tests/ui/traits/const-traits/staged-api.rs#stable' panicked at src/tools/compiletest/src/runtest.rs:789:13:
errors differ from expected


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants